import{MD5 as t,enc as r,SHA1 as e,mode as n,AES as p}from"crypto-js";import{consoleError as s}from"../console/index.mjs";const o={aes:{encrypt:(t,e,s,o=n.CBC)=>t?(e.length<32&&(e=e.padEnd(32,"f")),e.length>32&&(e=e.substring(0,32)),s.length<16&&(s=s.padEnd(16,"f")),s.length>16&&(s=s.substring(0,16)),p.encrypt(t,r.Utf8.parse(e),{iv:r.Utf8.parse(s),mode:o}).toString()):t,decrypt(t,e,o,g=n.CBC){if(!t)return null;e.length<32&&(e=e.padEnd(32,"f")),e.length>32&&(e=e.substring(0,32)),o.length<16&&(o=o.padEnd(16,"f")),o.length>16&&(o=o.substring(0,16));const a=p.decrypt(t,r.Utf8.parse(e),{iv:r.Utf8.parse(o),mode:g});try{const t=a.toString(r.Utf8);return JSON.parse(t)}catch(i){return s("AESCrypto",i),null}}},sha1:{encrypt:t=>t?e(t).toString(r.Hex).toUpperCase():t},MD5:{encrypt:e=>e?t(e).toString(r.Hex).toUpperCase():e}};export{o as cryptoUtil};
//# sourceMappingURL=index.mjs.map
